<%@page import="dao.MemberDao"%>
<%@page import="entities.Student"%>
<%@page import="dao.StudentDao"%>
<%@page import="java.util.Iterator"%>
<%@page import="entities.Query"%>
<%@page import="dao.QueryDao"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <link href="style2.css" rel="stylesheet" type="text/css" />
        <title>Details</title>
        <style type="text/css">
            <!--
            .style4 {font-family: "Segoe UI"}
            .style5 {color: #FFFFFF}
            -->
        </style>
    </head>

    <body>
        <div class="body">
            <div class="menu_top">Welcome, user, <a href="#">Log out</a></div>
            <a href="#"><div class="banner"></div></a>
            <div class="menu_main">
                <a href="index.jsp">
                    <div class="sub_menu">
                        <h2 align="center">Home</h2>
                    </div></a>
                <a href="viewcoure.jsp">
                    <div class="sub_menu">
                        <h2 align="center">View Courses </h2>
                    </div></a>
                <a href="answer.jsp">
                    <div class="sub_menu">
                        <h2 align="center">Answer</h2>
                    </div></a>
                <a href="changepass.jsp">
                    <div class="sub_menu">
                        <h2 align="center">Change PWD </h2>
                    </div></a>
                <a href="about.jsp">
                    <div class="sub_menu">
                        <h2 align="center">About</h2>
                    </div></a>
                <a href="contact.jsp">
                    <div class="sub_menu">
                        <h2 align="center">Contact</h2>
                    </div></a>
            </div>
            <a href="#"><div class="about"></div></a>
            <div class="answer_btn"><input type="button" id="btn_answer" value="Answer Query" /></div>
            <div class="details">
                <div class="style5" id="images">Get Time, Day </div>
                <div id="avatar"><img src="images/avatar-icon12.jpg" alt="o" /></div> 
                <%
                    QueryDao qd = new QueryDao();
                    StudentDao sd = new StudentDao();
                    for (Iterator it = qd.getQueryDetail(Integer.parseInt(request.getQueryString().split("=")[1])).iterator(); it.hasNext();) {
                        Query q = (Query) it.next();
                        Student s = new Student();
                        s.setStudentid(q.getStudentid());
                        int memberid = sd.getMemberIdOfStudent(s);
                        MemberDao md = new MemberDao();
                %>

                <div id="user_infor"><h2 class="style4"><a href="#"><%=md.getUsernameByID(memberid)%></a></h2>
                </div>
                <div id="user_details">
                    <input type="text" id="text" value="Name: Johan Jimishone" disabled="disabled" />
                    <input type="text" id="text" value="Join: Jun 2012" disabled="disabled"/>
                    <input type="text" id="text" value="Post: 999" disabled="disabled"/>
                </div>

                <div id="title"><h2 align="bottom"><strong><%=q.getTitle()%></strong></h2> 
                </div>
                <div id="content"><%= q.getQueryText()%></div>
                <% }%>
                <div id="quick_answer">
                    <div class="answer_btn1"><input type="button" id="btn_answer" value="Answer Query" /></div>
                </div>
            </div>
            <form id="frm1" method="post" acion="../../../AnswerQueryServlet">
                <div class="frm">
                    <div class="style1" id="top">Quick Answer </div>
                    <div id="content">
                        <textarea class="txt" dir="ltr" tabindex="-1" role="textbox" aria-label="Rich text editor, vB_Editor_QR_editor, press ALT 0 for help."  style="width: 970px; height: 100px;  resize: none; outline: none; text-align: left; "></textarea>
                    </div>
                    <div id="choose">
                        <div id="reply">
                            <input type="submit" id="submit" value="Reply" />
                        </div>
                        <div id="cancel">
                            <input type="reset" id="reset" value="Cancel" />
                        </div>
                    </div>
                </div>
            </form>
            <div class="footer"></div>
        </div>
    </body>
</html>
